package com.care.doctor.remote.factory;

import com.care.common.core.domain.Result;
import com.care.doctor.common.domain.DTOLabel;
import com.care.doctor.remote.LabelRemoteService;
import org.slf4j.Logger;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @Author: 靳家振
 * @Date: 2024/3/26 20:47
 * @Description:
 **/

@Component
public class LabelRemoteServiceFallbackFactory implements FallbackFactory<LabelRemoteService> {
    public final static Logger logger = org.slf4j.LoggerFactory.getLogger(LabelRemoteServiceFallbackFactory.class);
    @Override
    public LabelRemoteService create(Throwable cause) {
        logger.error ("属性列表服务错误: {}",cause.getMessage ());
        return new LabelRemoteService () {
            @Override
            public Result listAll() {
                return Result.error ("属性列表服务错误，请联系管理员");
            }

            @Override
            public Result<DTOLabel> findByLabelId(Integer labelId) {
                return Result.error ("属性列表服务错误，请联系管理员");
            }
        };
    }
}
